package com.umeox.watch.moto.dataservice.db.dao;


import android.database.Cursor;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.StoryPlayHistory;

import java.util.List;

@Dao
public interface StoryPlayHistoryDao {

    @Query("SELECT * FROM story_play_history")
    List<StoryPlayHistory> queryAll();

    @Query("SELECT * FROM story_play_history WHERE isUpload = 0 AND amount > 0")
    List<StoryPlayHistory> queryAllUnUploadHistory();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(StoryPlayHistory storyPlayHistory);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(List<StoryPlayHistory> storyPlayHistories);

    @Delete
    int delete(StoryPlayHistory storyPlayHistory);

    @Delete
    void delete(List<StoryPlayHistory> storyPlayHistories);

    @Query("DELETE FROM story_play_history")
    int deleteAll();

    @Query("SELECT * FROM story_play_history")
    Cursor query();
}
